package game.Rendering;

import game.Scene;
import game.SceneObject;
import game.Vector3;

import javafx.scene.paint.Color;

public class PointLight extends SceneObject {
    protected Vector3 position;
    protected double radius;
    protected Color color;

    public PointLight(Vector3 pos, double radius, Color c) throws Exception {
        if(Scene.getInstance() == null){
            throw new Exception("Light cannot be created without a scene.");
        }
        this.position = pos;
        this.radius = radius;
        this.color = c;

        Scene.getInstance().registerLight(this);
    }

    @Override
    public void destroy() {
        super.destroy();
        Scene.getInstance().deleteLight(this);
    }

    @Override
    public void update(double deltaTime) {
    }

    /**
     * @param position the position to set in the world
     */
    public void setPosition(Vector3 position) {
        this.position = new Vector3(position);
    }

    /**
     * @return the position of the light in the world
     */
    public Vector3 getPosition() {
        return new Vector3(this.position);
    }

    public void setColor(Color color) {
        this.color = color;
    }
    public Color getColor() {
        return color;
    }

    public double getRadius(){return this.radius;}
}
